package data;

/** Represents a bank account and its attributes.  
 * It also contains DTObjects for storing data of an account
 * @author Matthias
 * 
 */
public class Account {
	
	/** representing a unique account number **/
	private final int accNr;
	/** delcaring account type, used for defining the type of an accnr **/
	private final String accountType; 
	/** declaring interestRate, combined together with the type it has the matching rate **/
	private final String interestRate;
	/** declaring totalBalance, all funds available **/
	private double totalBalance; 

	/** Account constructor initializes attributes
	 * @param accNr
	 * @param accountType
	 * @param interestRate
	 * @param totalBalance
	 */
	public Account(final int accNr, final String accountType, 
			final String interestRate, final double totalBalance) {
		this.accNr = accNr;
		this.accountType = accountType;
		this.interestRate = interestRate;
		this.totalBalance = totalBalance;
	}

	/**
	 * @return account number
	 */
	public final int getAccountNumber() {
		return accNr;
	}
	
	/**
	 * @return account type
	 */
	public final String getAccountType() {
		return accountType;
	}
	
	/**
	 * @return interest rate
	 */
	public final String getInterestRate() {
		return interestRate;
	}

	/**
	 * @return total balance
	 */
	public final double getTotalBalance() {
		return totalBalance;
	}

	/** credits an amount to the account
	 * @param depositAmount
	 */
	public final void credit(final double depositAmount) {
		totalBalance += depositAmount; // add to total balance
	}
 
	/** debits an amount from the account
	 * @param withdrawalAmount
	 */
	public final void debit(final double withdrawalAmount) {
		totalBalance -= withdrawalAmount; // subtract from total balance
	}

} // end class Account